package net.hn.hnms.sys.system.remote;

import net.hn.hnms.sys.common.mybatis.config.MybatisMineCodeConfiguration;
import net.hn.hnms.sys.system.api.domain.SysLogininfor;
import net.hn.hnms.sys.system.api.domain.SysOperLog;
import net.hn.hnms.sys.system.service.ISysLogininforService;
import net.hn.hnms.sys.system.service.ISysOperLogService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 操作日志记录
 *
 * @author Lion Li
 */
@RequiredArgsConstructor
@Service
public class RemoteLogServiceImpl  {

    private final ISysOperLogService operLogService;
    private final ISysLogininforService logininforService;

    @Autowired(required = false)
    private MybatisMineCodeConfiguration.MineCode mineCode;

//    @Override
    public Boolean saveLog(SysOperLog sysOperLog) {

        sysOperLog.setMineCode(mineCode.getCode());
        return operLogService.insertOperlog(sysOperLog) > 0;
    }

//    @Override
    public Boolean saveLogininfor(SysLogininfor sysLogininfor) {
        return logininforService.insertLogininfor(sysLogininfor) > 0;
    }
}
